package mycine.model.beans;

import java.io.Serializable;
import java.util.List;
import javax.persistence.*;

/**
 *
 * @author Vincent
 */
@Entity
@Table(name = "usermc")
@NamedQueries({
	@NamedQuery(name = "Usermc.findAll", query = "SELECT u FROM Usermc u"),
	@NamedQuery(name = "Usermc.findByEmail", query = "SELECT u FROM Usermc u WHERE u.email = :email"),
	@NamedQuery(name = "Usermc.findByPassword", query = "SELECT u FROM Usermc u WHERE u.password = :password"),
	@NamedQuery(name = "Usermc.findByLastName", query = "SELECT u FROM Usermc u WHERE u.lastName = :lastName"),
	@NamedQuery(name = "Usermc.findByFirstName", query = "SELECT u FROM Usermc u WHERE u.firstName = :firstName"),
	@NamedQuery(name = "Usermc.findByCity", query = "SELECT u FROM Usermc u WHERE u.city = :city"),
	@NamedQuery(name = "Usermc.findByPhone", query = "SELECT u FROM Usermc u WHERE u.phone = :phone"),
	@NamedQuery(name = "Usermc.findByCitation", query = "SELECT u FROM Usermc u WHERE u.citation = :citation"),
	@NamedQuery(name = "Usermc.findByGender", query = "SELECT u FROM Usermc u WHERE u.gender = :gender")})
public class Usermc implements Serializable {
	private static final long serialVersionUID = 1L;
	@Id
    @Basic(optional = false)
    @Column(name = "email")
	private String email;
	@Basic(optional = false)
    @Column(name = "password")
	private String password;
	@Basic(optional = false)
    @Column(name = "lastName")
	private String lastName;
	@Basic(optional = false)
    @Column(name = "firstName")
	private String firstName;
	@Column(name = "city")
	private String city;
	@Column(name = "phone")
	private String phone;
	@Column(name = "citation")
	private String citation;
	@Column(name = "gender")
	private String gender;
	@JoinTable(name = "userseries", joinColumns = {
    	@JoinColumn(name = "user", referencedColumnName = "email")}, inverseJoinColumns = {
    	@JoinColumn(name = "series", referencedColumnName = "id")})
    @ManyToMany
	private List<Series> seriesList;
	@JoinTable(name = "userfilms", joinColumns = {
    	@JoinColumn(name = "user", referencedColumnName = "email")}, inverseJoinColumns = {
    	@JoinColumn(name = "film", referencedColumnName = "id")})
    @ManyToMany
	private List<Film> filmList;
	@JoinColumn(name = "status", referencedColumnName = "id")
    @ManyToOne(optional = false)
	private Status status;

	public Usermc() {
	}

	public Usermc(String email) {
		this.email = email;
	}

	public Usermc(String email, String password, String lastName, String firstName) {
		this.email = email;
		this.password = password;
		this.lastName = lastName;
		this.firstName = firstName;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getLastName() {
		return lastName;
	}

	public void setLastName(String lastName) {
		this.lastName = lastName;
	}

	public String getFirstName() {
		return firstName;
	}

	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	public String getCity() {
		return city;
	}

	public void setCity(String city) {
		this.city = city;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public String getCitation() {
		return citation;
	}

	public void setCitation(String citation) {
		this.citation = citation;
	}

	public String getGender() {
		return gender;
	}

	public void setGender(String gender) {
		this.gender = gender;
	}

	public List<Series> getSeriesList() {
		return seriesList;
	}

	public void setSeriesList(List<Series> seriesList) {
		this.seriesList = seriesList;
	}

	public List<Film> getFilmList() {
		return filmList;
	}

	public void setFilmList(List<Film> filmList) {
		this.filmList = filmList;
	}

	public Status getStatus() {
		return status;
	}

	public void setStatus(Status status) {
		this.status = status;
	}

	@Override
	public int hashCode() {
		int hash = 0;
		hash += (email != null ? email.hashCode() : 0);
		return hash;
	}

	@Override
	public boolean equals(Object object) {
		// TODO: Warning - this method won't work in the case the id fields are not set
		if (!(object instanceof Usermc)) {
			return false;
		}
		Usermc other = (Usermc) object;
		if ((this.email == null && other.email != null) || (this.email != null && !this.email.equals(other.email))) {
			return false;
		}
		return true;
	}

	@Override
	public String toString() {
		return "mycine.model.beans.Usermc[ email=" + email + " ]";
	}
	
}
